package com.zq.controller;

import com.zq.entity.Tag;
import com.zq.repository.TagRepository;
import com.zq.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author:任人渐疏
 * @Date:Created in 12:16 下午 2020/6/27
 * Update:true
 */
@RequestMapping("tag")
@RestController
public class TagController {
    @Autowired
    private TagRepository tagRepository;
    @Autowired
    private TagService tagService;

    @GetMapping
    public Object getAllList(Tag tag,Integer page){
        return tagService.findAllList(tag,page);
    }

    @PostMapping
    public  Object AddTag(Tag tag){
        return  tagService.addTag(tag);
    }
    @PutMapping
    public  Object UpdateTag(Tag tag){
        return tagService.updateTag(tag);
    }
    @DeleteMapping
    public  Object deleteTag(String tagid){
        return tagService.deleteTag(tagid);
    }
    @GetMapping("getAllTag")
    public  Object getAllTag(){
        return tagRepository.getAllTag();
    }
}
